// Copyright (c) 2009 Luca Marrocco.
// Modified or written by Luca Marrocco for inclusion with codej.
// Licensed under the Apache License, Version 2.0 (the "License")
package codej.ast;

/** @author Luca Marrocco */
public class Modifier extends AbstractNode {

	public static final Modifier publicModifier = createModifier("public");
	public static final Modifier protectedModifier = createModifier("protected");
	public static final Modifier privateModifier = createModifier("private");
	public static final Modifier abstractModifier = createModifier("abstract");
	public static final Modifier staticModifier = createModifier("static");
	public static final Modifier finalModifier = createModifier("final");
	public static final Modifier synchronizedModifier = createModifier("synchronized");
	public static final Modifier nativeModifier = createModifier("native");
	public static final Modifier transientModifier = createModifier("transient");
	public static final Modifier volatileModifier = createModifier("volatile");
	public static final Modifier strictfpModifier = createModifier("strictfp");
	
	private String name;

	private static synchronized Modifier createModifier(String name) {
		return new Modifier(name);
	}

	protected Modifier(String name) {
		setName(name);
	}

	public void accept(Visitor visitor) {
		visitor.visit(this);
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public String toString() {
		return name;
	}

}
